package com.example.controller;


import com.example.common.result.Result;
import com.example.mapper.CmsmgMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LiangPandeng
 * @since 2024-04-02
 */
@RestController
@RequestMapping("/api/cmsmg")
@Api( tags = "币种汇率表接口")
public class CmsmgController {

    @Autowired
    private CmsmgMapper mapper;

    @ApiOperation("最新币种汇率")
    @GetMapping("latestExchangeRate")
    public Result latestExchangeRate(@RequestParam String coinType) {
        if(coinType.trim().equals("RMB")) {
            return Result.success(1D);
        }
       return Result.success(mapper.getLatestRate(coinType));
    }

}
